// 显式导入process，解决IDE警告
import * as process from 'process';

/**
 * 应用配置
 * 集中管理应用的各种配置项
 * 可通过环境变量覆盖默认值
 */
export default () => ({
  // 服务器配置
  server: {
    port: parseInt(process.env.PORT || '3000', 10),
    host: process.env.HOST || 'localhost',
  },
  // 数据库配置
  database: {
    host: process.env.DB_HOST || 'localhost',
    port: parseInt(process.env.DB_PORT || '5432', 10),
    username: process.env.DB_USERNAME || 'postgres',
    password: process.env.DB_PASSWORD || 'postgres',
    database: process.env.DB_DATABASE || 'nest_app',
  },
  // JWT配置
  jwt: {
    secret: process.env.JWT_SECRET || 'your-secret-key',
    expiresIn: process.env.JWT_EXPIRES_IN || '60m',
  },
  // 应用环境
  environment: process.env.NODE_ENV || 'development',
}); 